<?php

namespace App\Http\Requests\Logic\Genre;

use Illuminate\Foundation\Http\FormRequest;

class StoreResource extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return isManager();
    }

	/**
	 * 定义表单验证规则
	 *
	 * Date: 21/04/2018
	 * @author George
	 * @return array
	 */
    public function rules()
    {
        return [
        	'project_id' => 'required',
        	'code' => 'required|unique:genres',
        	'name' => 'required',
        	'start' => 'required',
        	'end' => 'required',
        ];
    }

	/**
	 * 定义表单验证错误消息
	 *
	 * Date: 21/04/2018
	 * @author George
	 * @return array
	 */
	public function messages()
	{
		return [
			'code.required' => '请输入排班类型编码',
			'code.unique' => '指定的编码已存在',
			'name.required' => '请输入排班类型名称',
			'start.required' => '请输入开始时间',
			'end.required' => '请输入结束时间'
		];
    }
}
